public class MaxDeepth {
    // 二叉树的最大深度
    // https://www.nowcoder.com/practice/8a2b2bf6c19b4f23a9bdb9b233eefa73?tpId=295&tqId=642&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3DSQL%25E7%25AF%2587%26topicId%3D295
    public int maxDepth (TreeNode root) {
        // write code here
        if(root == null) {
            return 0;
        }
        int leftDeepth = maxDepth(root.left);
        int rightDeepth = maxDepth(root.right);
        return Math.max(leftDeepth, rightDeepth) + 1;
    }
}
